﻿<!DOCTYPE>

<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <meta http-equiv="content-type" content="txt/html charset=utf-8" />
    <title>MES后台管理</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
   
</head>
<body>
    <div class="panelSection">    
        <div class="easyui-panel " title="Windows服务管理" style="padding:3px;" 
        data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
            <div>
                <table id="tbWinService" class="easyui-datagrid" style="height: 250px;" data-options="rownumbers:true"
                singleSelect="true">
              </table>
            </div>

        </div> 

    </div> 
</body>
</html>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/ReferenceJsLib.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script type="text/javascript">
    /*
    创建人：Wangjh
    日期：2022-04-28
    描述：有限排产js
    */
    var page = {
        pagetotal: 0,
        pageSize: 5,
        pageNumber: 1,
        rootPath: getRootPath(), //网站根路径
        ajaxUrl: getRootPath() + "/Ashx/HomeHandler.ashx",
        //初始化页面
        init: function () {
            page.bind();
        },
        //页面事件绑定
        bind: function () {
            // 批次信息
            $("#tbWinService").datagrid({
                columns: [[
                        { field: 'serviceName', title: '服务名', width: 120 },
                        { field: 'serviceDesc', title: '服务描述', width: 200 },
                        { field: 'operate', title: '操作', width: 300, formatter: function (value, row, index) {
                            var para = {
                                serviceName: row.serviceName
                            }

                            var btnHtml = "<button   class='operateService' onclick=page.operateService('" + JSON.stringify(para) + "',1) style='cursor:pointer;width: 60px; height: 22px'>启动</button>";
                            btnHtml += "<button   class='operateService' onclick=page.operateService('" + JSON.stringify(para) + "',0) style='cursor:pointer;margin-left:5px;width: 60px; height: 22px'>停止</button>";

                            return btnHtml
                        }
                        }
                    ]],
                data: [
                        { serviceName: "TransferMESData", serviceDesc: "总表Containercurrentinfo服务" }
                    ],
                onLoadSuccess: function (data) {

                }

            });
        },
        //type:0停止，1启动
        operateService: function (param, type) {
            var _param = JSON.parse(param);
            var formData = { serviceName: _param.serviceName };
            if (type == 0) {
                formData.action = "stopService";
            } else if (type == 1) {
                formData.action = "startService";
            }

            $.ajax({
                type: "Post",
                url: page.ajaxUrl,
                data: formData,
                cashe: false,
                async: true,
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    var result = JSON.parse(data);
                    if (result.Result) {
                        displayMessage("处理完成", true);
                    } else {
                        displayMessage(result.Message, false);
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    alert(XMLHttpRequest.responseText);
                }
            });
        },
        //清除方法，重要！！！
        reset: function (iscondition, isresult) {
            clearMessage();

        }
    }
    $(function () {
        page.init();
    });
</script>
